package com.yjz.normal_skill.spider;

/**
 * @Desc 爬虫
 * @Author: jinzhong.yuan
 * @Date: 2019/2/21 22:35
 */
public class BossSpider {
  public static void spider() {// 爬虫
//        System.out.println("------Begin--------------");
//        //String url ="https://m.zhipin.com/weijd/v2/job/41e876ca76f18ca51XVz0925ElI~";
//        String url = "https://m.zhipin.com/weijd/v2/job/cc53ec27840e3f810nN42967FQ~~";
//
//        System.setProperty("webdriver.chrome.driver", "/Tool/chromedriver");
//        WebDriver driver = new ChromeDriver();
//        driver.get(url);
//
//        (new WebDriverWait(driver, 30)).until(new ExpectedCondition<Boolean>() {
//            public Boolean apply(WebDriver dr) {
//                int index = dr.getPageSource().indexOf("boss-message");
//                if (index != -1) {
//                    return true; // 找到，退出等待
//                } else {
//                    return false; // 未找到，继续等待
//                }
//            }
//        });
//
//
//        WebElement bossname = driver.findElement(By.cssSelector("div.boss-message"));
//        System.out.println(bossname.getText());;
//
//        List<WebElement> eleBoxs = driver.findElements(By.cssSelector("div.rec-position"));
//        for (WebElement eleBox : eleBoxs) {
//            WebElement eleTitle = eleBox.findElement(By.cssSelector("p.name"));
//            WebElement eleAnswer = eleBox.findElement(By.cssSelector("p.salary"));
//            System.out.println(eleTitle.getText() +"   薪资水平： "+eleAnswer.getText());
//        }
//        WebElement strength = driver.findElement(By.cssSelector("div.tags-position"));
//        System.out.println(strength.getText());;
//
//
//        // WebElement jobdetails = driver.findElement(By.xpath(".//*[@id='container']/div[2]/div[3]/div[2]/div[1]"));
//        WebElement jobdetails = driver.findElement(By.className("detail-text"));
//
//
//        System.out.println(jobdetails.getText());
//        driver.quit();


  }

  public static void main(String[] args) {
    BossSpider.spider();
  }
}
